<?php
/**
 * This class is a mock of the Facebook object, and is used for testing.
 * It's methods just return values for testing purposes.
 * This is necessary to allow local testing of facebook app
 * 
 * @author Matt Makins http://mattmakins.co.uk
 * 
 * Feel free to use these mock classes, there's not really much to them!
 * You will probably have to extend it to include all of the facebook
 * api methods your application uses, but you get the idea!
 */
class FacebookMock{
	
	public $api_client;
	
	public function FacebookMock(){
		$this->api_client = new FacebookAPIClientMock();
	}
	
	/**
	 * this will stop your application trying to use
	 * the facebook frame when running locally.
	 */
	public function require_frame(){
		return null;
	}

    // change this to whatever value you like
	const TEST_USER = "11111";

	public function require_login(){
		return self::TEST_USER;
	}
	
	public function get_loggedin_user(){
		return self::TEST_USER;
	}	
	
	public function areFriends(){
		return $this->api_client->friends_areFriends();
	}
}

class FacebookAPIClientMock{
	
	public function users_isAppAdded(){
		return true;
	}

	public function profile_setFBML(){
		return null;
	}
	
	public function users_getInfo(){
		
		return array(array("first_name" => "Matt",
						   "last_name" => "Makins"));
	}

	public function friends_areFriends(){
		return false;		
	}
}
?>
